<h3 class="yellow-bg-title" id="sign-in-title">Sign In</h3>
<?php if ($command == "redirect"): ?>
    <div id="success-notice-2">
        Welcome, Batanayi, you've successfully signed in to DocPlus! Please wait a moment while this page is being refreshed on your behalf.
    </div>
    <div class="loading"><img src="/images/loading.gif" alt="Loading..."></div>
    <script type="text/javascript">
        //[CDATA[
        $(document).ready(function(){
            // reload the current parent window
            reloadWindow();
        });
        //]]
    </script>
<?php else: ?>
    <form id="sign-in-form-modal" action="<?php echo url_for('/profile-sign-in-modal') ?>" method="post">
        <?php echo $form->renderHiddenFields(true) ?>
        <div class="row">
            <ul class="text">
                <li class="first">
                    <?php echo $form['email']->renderLabel() ?>
                    <?php echo $form['email'] ?>
                    <?php if ($form["email"]->hasError()): ?>
                        <?php include_partial("common/error", array("form" => $form, "field" => "email", "name_format" => "sign_in")) ?>
                    <?php endif; ?>
                <li>
                    <?php echo $form['password']->renderLabel() ?>
                    <?php echo $form['password'] ?>
                    <?php if ($form["password"]->hasError()): ?>
                        <?php include_partial("common/error", array("form" => $form, "field" => "password", "name_format" => "sign_in")) ?>
                    <?php endif; ?>
                </li>
            </ul>
        </div>
        <div class="clear"></div>
        <div class="sign-in-row">
            <ul class="submit">
                <li>
                    <button class="blue-button-30" type="submit" id="submit-sign-in-modal">Sign In</button>
                </li>
                <li>
                    <div>I forgot my <a id="forgot-password-link-modal" href="javascript:;">password</a></div>
                </li>
            </ul>
        </div>
    </form>
    <script type="text/javascript">
        //<![CDATA[
        $(document).ready(function(){
            // hide element's error on focus
            $formElement = $('form .prompt-text');
            $formElement.live("focus", function() {
                $this = $(this);
                $("#" + $this.attr("id") + "_error").addClass("error-invisible").removeClass("error-visible");
            });

            // don't show the labels for non-empty input elements
            $('form .prompt-text').each(function(){
                $this = $(this);
                $thisLabel = $this.parent().find(":eq(0)");

                if($.trim($this.val())) {
                    $thisLabel.addClass("label-invisible");
                    $this.addClass('user-text');
                }
            });

            // make an attempt to submit this form
            $('#submit-sign-in-modal').click(function() {        
                $("#sign-in-form-modal").hide();
                $("#sign-in-block-modal").append(loadingHtml);
                $('#sign-in-form-modal').ajaxSubmit(function(data){
                    $('#sign-in-block-modal').html(data);
                });
                return false;
            });

            $('#forgot-password-link-modal').click(function() {
                $('#sign-in-block-modal').hide();
                $('#reset-password-block-modal').removeClass('hide');
                $('#reset-password-block-modal').show();
                return false;
            });
        });
        //]]>
    </script>
<?php endif; ?>